#pragma once

#include <QWidget>
#include "DetailTipsData.h"

class DetailData;
class QLabel;
class SMenuButton;
class BondDetailTab : public QWidget
{
    Q_OBJECT
public:
    enum SUBPAGE_TYPE
    {
        BROKERDAILY,
        EXCHANGE,
        HISTORY,
        LIQUIDITYSCORE,
        PROFILE,
        ISSUER,
        RELATED,
        RATING,
        VALUATION,
        SPREAD,
    };
    Q_ENUM(SUBPAGE_TYPE)

	BondDetailTab(QWidget* p, QSharedPointer<DetailData> data);
	void setSelIndex(int index);

protected:
	void paintEvent(QPaintEvent* event) override;
	void resizeEvent(QResizeEvent* event) override;
	bool eventFilter(QObject* watched, QEvent* event) override;
	void mouseMoveEvent(QMouseEvent* event) override;

protected slots:
	void onBondChanged();
	void onShowMenu(int index);
	void onBtnClicked(int index);
    void onMenuClicked(SUBPAGE_TYPE index);
	void showBasicInfo(QString bondkey, int type);

private:
	void resizeChildren();

signals:
	void tabSelected(int broker);

private:
	QSharedPointer<DetailData> m_data = nullptr;
	DetailTipsData* m_tipsData = nullptr;
	QLabel* m_labelFirst = nullptr;
	QLabel* m_labelSecond = nullptr;
	SMenuButton* m_btnF9 = nullptr;
	SMenuButton* m_btnIssue = nullptr;
	bool	m_showBoth = false;
	int			m_selBroker = -1;
	QString		m_styleSheet;
	bool		m_showBasicInfo = true;
	QRect		m_tipsRect;
};
